/*
Copyright (C) 2018-2019 de4dot@gmail.com

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

use core::fmt;

// GENERATOR-BEGIN: CtorKind
// ⚠️This was generated by GENERATOR!🦹‍♂️
#[derive(Copy, Clone, Eq, PartialEq)]
#[allow(non_camel_case_types)]
#[allow(dead_code)]
pub(crate) enum CtorKind {
	Previous,
	Normal_1,
	Normal_2,
	AamAad,
	asz,
	AX,
	AY,
	bcst,
	bnd_1,
	bnd_2,
	DeclareData,
	DX,
	er_2,
	er_3,
	far,
	far_mem,
	invlpga,
	maskmovq,
	mmxmem_1,
	mmxmem_2,
	mmxmem_3,
	movabs,
	ms_pops,
	nop,
	OpSize,
	OpSize2_bnd,
	OpSize3,
	os_2,
	os_3,
	os_call_2,
	os_call_3,
	CC_1,
	CC_2,
	CC_3,
	os_jcc_a_1,
	os_jcc_a_2,
	os_jcc_a_3,
	os_jcc_b_1,
	os_jcc_b_2,
	os_jcc_b_3,
	os_loopcc,
	os_loop,
	os_mem,
	os_mem_reg16,
	os_mem2,
	pblendvb_1,
	pblendvb_2,
	pclmulqdq,
	pops_2,
	pops_3,
	Reg16,
	reverse2,
	sae,
	sae_pops,
	SEX1,
	SEX1a,
	SEX2_2,
	SEX2_3,
	SEX2_4,
	SEX3,
	STIG1_1,
	STIG1_2,
	STIG2_2a,
	STIG2_2b,
	XLAT,
	XY,
	YA,
	YD,
	YX,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_CTOR_KIND: [&str; 69] = [
	"Previous",
	"Normal_1",
	"Normal_2",
	"AamAad",
	"asz",
	"AX",
	"AY",
	"bcst",
	"bnd_1",
	"bnd_2",
	"DeclareData",
	"DX",
	"er_2",
	"er_3",
	"far",
	"far_mem",
	"invlpga",
	"maskmovq",
	"mmxmem_1",
	"mmxmem_2",
	"mmxmem_3",
	"movabs",
	"ms_pops",
	"nop",
	"OpSize",
	"OpSize2_bnd",
	"OpSize3",
	"os_2",
	"os_3",
	"os_call_2",
	"os_call_3",
	"CC_1",
	"CC_2",
	"CC_3",
	"os_jcc_a_1",
	"os_jcc_a_2",
	"os_jcc_a_3",
	"os_jcc_b_1",
	"os_jcc_b_2",
	"os_jcc_b_3",
	"os_loopcc",
	"os_loop",
	"os_mem",
	"os_mem_reg16",
	"os_mem2",
	"pblendvb_1",
	"pblendvb_2",
	"pclmulqdq",
	"pops_2",
	"pops_3",
	"Reg16",
	"reverse2",
	"sae",
	"sae_pops",
	"SEX1",
	"SEX1a",
	"SEX2_2",
	"SEX2_3",
	"SEX2_4",
	"SEX3",
	"STIG1_1",
	"STIG1_2",
	"STIG2_2a",
	"STIG2_2b",
	"XLAT",
	"XY",
	"YA",
	"YD",
	"YX",
];
impl fmt::Debug for CtorKind {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_CTOR_KIND[*self as usize])?;
		Ok(())
	}
}
impl Default for CtorKind {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		CtorKind::Previous
	}
}
// GENERATOR-END: CtorKind

// GENERATOR-BEGIN: SignExtendInfo
// ⚠️This was generated by GENERATOR!🦹‍♂️
#[derive(Copy, Clone, Eq, PartialEq)]
#[allow(non_camel_case_types)]
#[allow(dead_code)]
pub(crate) enum SignExtendInfo {
	None,
	Sex1to2,
	Sex1to4,
	Sex1to8,
	Sex4to8,
	Sex4to8Qword,
	Sex2,
	Sex4,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_SIGN_EXTEND_INFO: [&str; 8] = [
	"None",
	"Sex1to2",
	"Sex1to4",
	"Sex1to8",
	"Sex4to8",
	"Sex4to8Qword",
	"Sex2",
	"Sex4",
];
impl fmt::Debug for SignExtendInfo {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_SIGN_EXTEND_INFO[*self as usize])?;
		Ok(())
	}
}
impl Default for SignExtendInfo {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		SignExtendInfo::None
	}
}
// GENERATOR-END: SignExtendInfo

// GENERATOR-BEGIN: SizeOverride
// ⚠️This was generated by GENERATOR!🦹‍♂️
#[derive(Copy, Clone, Eq, PartialEq)]
#[allow(non_camel_case_types)]
#[allow(dead_code)]
pub(crate) enum SizeOverride {
	None,
	Size16,
	Size32,
	Size64,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_SIZE_OVERRIDE: [&str; 4] = [
	"None",
	"Size16",
	"Size32",
	"Size64",
];
impl fmt::Debug for SizeOverride {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_SIZE_OVERRIDE[*self as usize])?;
		Ok(())
	}
}
impl Default for SizeOverride {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		SizeOverride::None
	}
}
// GENERATOR-END: SizeOverride

// GENERATOR-BEGIN: BranchSizeInfo
// ⚠️This was generated by GENERATOR!🦹‍♂️
#[derive(Copy, Clone, Eq, PartialEq)]
#[allow(non_camel_case_types)]
#[allow(dead_code)]
pub(crate) enum BranchSizeInfo {
	None,
	Near,
	NearWord,
	NearDword,
	Word,
	Dword,
	Short,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_BRANCH_SIZE_INFO: [&str; 7] = [
	"None",
	"Near",
	"NearWord",
	"NearDword",
	"Word",
	"Dword",
	"Short",
];
impl fmt::Debug for BranchSizeInfo {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_BRANCH_SIZE_INFO[*self as usize])?;
		Ok(())
	}
}
impl Default for BranchSizeInfo {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		BranchSizeInfo::None
	}
}
// GENERATOR-END: BranchSizeInfo

// GENERATOR-BEGIN: InstrOpInfoFlags
// ⚠️This was generated by GENERATOR!🦹‍♂️
pub(crate) struct InstrOpInfoFlags;
#[allow(dead_code)]
impl InstrOpInfoFlags {
	pub(crate) const NONE: u32 = 0x0000_0000;
	pub(crate) const MEM_SIZE_NOTHING: u32 = 0x0000_0001;
	pub(crate) const SHOW_NO_MEM_SIZE_FORCE_SIZE: u32 = 0x0000_0002;
	pub(crate) const SHOW_MIN_MEM_SIZE_FORCE_SIZE: u32 = 0x0000_0004;
	pub(crate) const SIZE_OVERRIDE_MASK: u32 = 0x0000_0003;
	pub(crate) const OP_SIZE_SHIFT: u32 = 0x0000_0003;
	pub(crate) const OP_SIZE16: u32 = 0x0000_0008;
	pub(crate) const OP_SIZE32: u32 = 0x0000_0010;
	pub(crate) const OP_SIZE64: u32 = 0x0000_0018;
	pub(crate) const ADDR_SIZE_SHIFT: u32 = 0x0000_0005;
	pub(crate) const ADDR_SIZE16: u32 = 0x0000_0020;
	pub(crate) const ADDR_SIZE32: u32 = 0x0000_0040;
	pub(crate) const ADDR_SIZE64: u32 = 0x0000_0060;
	pub(crate) const BRANCH_SIZE_INFO_SHIFT: u32 = 0x0000_0007;
	pub(crate) const BRANCH_SIZE_INFO_MASK: u32 = 0x0000_0007;
	pub(crate) const BRANCH_SIZE_INFO_SHORT: u32 = 0x0000_0300;
	pub(crate) const SIGN_EXTEND_INFO_SHIFT: u32 = 0x0000_000A;
	pub(crate) const SIGN_EXTEND_INFO_MASK: u32 = 0x0000_0007;
	pub(crate) const MEMORY_SIZE_INFO_SHIFT: u32 = 0x0000_000D;
	pub(crate) const MEMORY_SIZE_INFO_MASK: u32 = 0x0000_0003;
	pub(crate) const FAR_MEMORY_SIZE_INFO_SHIFT: u32 = 0x0000_000F;
	pub(crate) const FAR_MEMORY_SIZE_INFO_MASK: u32 = 0x0000_0003;
	pub(crate) const REGISTER_TO: u32 = 0x0002_0000;
	pub(crate) const BND_PREFIX: u32 = 0x0004_0000;
	pub(crate) const MNEMONIC_IS_DIRECTIVE: u32 = 0x0008_0000;
	pub(crate) const JCC_NOT_TAKEN: u32 = 0x0010_0000;
	pub(crate) const JCC_TAKEN: u32 = 0x0020_0000;
	pub(crate) const MEMORY_SIZE_BITS: u32 = 0x0000_0008;
	pub(crate) const MEMORY_SIZE_SHIFT: u32 = 0x0000_0016;
	pub(crate) const MEMORY_SIZE_MASK: u32 = 0x0000_00FF;
}
// GENERATOR-END: InstrOpInfoFlags

// GENERATOR-BEGIN: InstrOpKind
// ⚠️This was generated by GENERATOR!🦹‍♂️
#[derive(Copy, Clone, Eq, PartialEq)]
#[allow(non_camel_case_types)]
#[allow(dead_code)]
pub(crate) enum InstrOpKind {
	Register,
	NearBranch16,
	NearBranch32,
	NearBranch64,
	FarBranch16,
	FarBranch32,
	Immediate8,
	Immediate8_2nd,
	Immediate16,
	Immediate32,
	Immediate64,
	Immediate8to16,
	Immediate8to32,
	Immediate8to64,
	Immediate32to64,
	MemorySegSI,
	MemorySegESI,
	MemorySegRSI,
	MemorySegDI,
	MemorySegEDI,
	MemorySegRDI,
	MemoryESDI,
	MemoryESEDI,
	MemoryESRDI,
	Memory64,
	Memory,
	Sae,
	RnSae,
	RdSae,
	RuSae,
	RzSae,
	DeclareByte,
	DeclareWord,
	DeclareDword,
	DeclareQword,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_INSTR_OP_KIND: [&str; 35] = [
	"Register",
	"NearBranch16",
	"NearBranch32",
	"NearBranch64",
	"FarBranch16",
	"FarBranch32",
	"Immediate8",
	"Immediate8_2nd",
	"Immediate16",
	"Immediate32",
	"Immediate64",
	"Immediate8to16",
	"Immediate8to32",
	"Immediate8to64",
	"Immediate32to64",
	"MemorySegSI",
	"MemorySegESI",
	"MemorySegRSI",
	"MemorySegDI",
	"MemorySegEDI",
	"MemorySegRDI",
	"MemoryESDI",
	"MemoryESEDI",
	"MemoryESRDI",
	"Memory64",
	"Memory",
	"Sae",
	"RnSae",
	"RdSae",
	"RuSae",
	"RzSae",
	"DeclareByte",
	"DeclareWord",
	"DeclareDword",
	"DeclareQword",
];
impl fmt::Debug for InstrOpKind {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_INSTR_OP_KIND[*self as usize])?;
		Ok(())
	}
}
impl Default for InstrOpKind {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		InstrOpKind::Register
	}
}
// GENERATOR-END: InstrOpKind

// GENERATOR-BEGIN: MemorySizeInfo
// ⚠️This was generated by GENERATOR!🦹‍♂️
#[derive(Copy, Clone, Eq, PartialEq)]
#[allow(non_camel_case_types)]
#[allow(dead_code)]
pub(crate) enum MemorySizeInfo {
	None,
	Word,
	Dword,
	Qword,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_MEMORY_SIZE_INFO: [&str; 4] = [
	"None",
	"Word",
	"Dword",
	"Qword",
];
impl fmt::Debug for MemorySizeInfo {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_MEMORY_SIZE_INFO[*self as usize])?;
		Ok(())
	}
}
impl Default for MemorySizeInfo {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		MemorySizeInfo::None
	}
}
// GENERATOR-END: MemorySizeInfo

// GENERATOR-BEGIN: FarMemorySizeInfo
// ⚠️This was generated by GENERATOR!🦹‍♂️
#[derive(Copy, Clone, Eq, PartialEq)]
#[allow(non_camel_case_types)]
#[allow(dead_code)]
pub(crate) enum FarMemorySizeInfo {
	None,
	Word,
	Dword,
}
#[cfg_attr(feature = "cargo-fmt", rustfmt::skip)]
static GEN_DEBUG_FAR_MEMORY_SIZE_INFO: [&str; 3] = [
	"None",
	"Word",
	"Dword",
];
impl fmt::Debug for FarMemorySizeInfo {
	#[inline]
	fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
		write!(f, "{}", GEN_DEBUG_FAR_MEMORY_SIZE_INFO[*self as usize])?;
		Ok(())
	}
}
impl Default for FarMemorySizeInfo {
	#[cfg_attr(has_must_use, must_use)]
	#[inline]
	fn default() -> Self {
		FarMemorySizeInfo::None
	}
}
// GENERATOR-END: FarMemorySizeInfo
